package com.uenpay.im.ui.old.activity.company;

import com.uenpay.im.configuration.APIConfiguration;
import com.uenpay.im.entities.HttpInvokeResult;
import com.uenpay.im.invokeitems.BaseHttpInvokeItem;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author SL
 * @created 2016-2-22 13:52:22
 * @copyRight http://www.qiyunxin.com
 */
public class DeleteEmployeeInvokeItem extends BaseHttpInvokeItem {

	public class DeleteEmployeeInvokeItemResult extends HttpInvokeResult {
	}

	public DeleteEmployeeInvokeItemResult getOutPut() {
		return (DeleteEmployeeInvokeItemResult) GetResultObject();
	}

	/**
	 * 
	 * @param entid
	 * @param departid
	 * @param custids
	 */
	public DeleteEmployeeInvokeItem(int entid, int departid, String custids) {
		String url = APIConfiguration.getBaseUrl()
				+ "Organization/Organization/deleteEntCust?departid="
				+ departid + "&entid=" + entid + "&custids=" + custids + "&"
				+ APIConfiguration.getCustIdAndToken();
		SetUrl(url);
	}

	@Override
	protected Object DeserializeResult(String responseBody) {
		DeleteEmployeeInvokeItemResult result = new DeleteEmployeeInvokeItemResult();
		try {
			JSONObject json = new JSONObject(responseBody);
			result.status = json.optInt("status");
			result.msg = json.optString("msg");
		} catch (JSONException e) {
			e.printStackTrace();
			return result;
		}

		return result;
	}

}
